#!/usr/bin/python
# -*- coding: UTF-8 -*-

from kpautos.engine.case import Case
from kptest.config.enum import DeviceType, HostType, DeviceUtility


class TestCaseWithApi(Case):
    """
        Name:
            TestCaseWithApi
        Label:
            ipmi_api测试
        PreCondition:

        TestStep:
            1) API查询sensor信息
        ExpectedResult:
            A) 查询得到正确的sensor信息
        Parameters:

        Author:
            XXXXXX
        Last Modified:
            xxxx-xx-xx
        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        self.logger.info("Pre Test Case Start.... ")
        # get_device 实例化Device对象
        self.device_dut = self.resource.get_device(device_type=DeviceType.Server, utility=DeviceUtility.DUT)
        self.host_obj = self.device_dut.get_host(host_type=HostType.HostOS)
        # get_api 实例化Api对象
        self.ipmi_api = self.device_dut.get_api(ns_name="Ipmi", dispatch=self.host_obj)

    # 测试步骤
    def procedure(self):
        self.log_step("Step1: 带外查询传感器列表")
        sensor_list = self.ipmi_api.ipmi_get_sensor_list()
        self.logger.info(f"查询到的传感器信息未：{sensor_list}")


    # 测试结束后恢复环境

    def post_test_case(self):
        pass
